IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[spVehicle_InsertVehicle]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spVehicle_InsertVehicle]
GO

GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Eric Liew
-- Create date: 6/2/2009
-- Description:	Insert a Vehicle
-- =============================================
CREATE PROCEDURE [dbo].[spVehicle_InsertVehicle]
(
	@EngineNo VARCHAR(40),
	@ManufactureDate DateTime,
	@CarExpiryDate DATETIME,
	@RegistrationDueDate DateTime,
	@InspectionDate DateTime,
	@PurchasePrice Varchar(50),
	@OwnerId INT,
	@PurchaseDate DateTime,
	@Rego Varchar(10),
	@BodyType Int,
	@Model Varchar(20)

)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON

	INSERT Vehicle
	(
		EngineNo,
		ManufactureDate,
		CarExpiryDate,
		RegistrationDueDate,
		InspectionDate,
		PurchasePrice,
		OwnerId,
		PurchaseDate,
		Rego,
		BodyType,
		Model,
		Active
	)
	VALUES
	(
		@EngineNo,
		@ManufactureDate,
		@CarExpiryDate,
		@RegistrationDueDate,
		@InspectionDate,
		@PurchasePrice,
		@OwnerId,
		@PurchaseDate,
		@Rego,
		@BodyType,
		@Model,
		1
	) 	

	SELECT @@IDENTITY 
	

 

END
GO
